#pragma once

#include<iostream>
#include <stdbool.h>
#include <string.h>

namespace word
{
	
	class string
	{
	public:
		typedef char* iterator;
		string(const char* str = " ")
		{
			_capacity = _size = strlen(str);
			_str = new char[_size + 1];
			strcpy(_str, str);
		}

		string(const string& str);


		~string()
		{
			delete[] _str;
			_size = _capacity = 0;
		}

		iterator begin();

		iterator end();

		string& reserve(size_t n);
		string& push_back(char ch);
		string& append(const char* str);

		const char* c_str();

		//std::ostream& operator << (std::ostream& out, const string& str);
		//std::istream& operator >> (std::istream& out, string& str);
	private:
		char* _str;
		size_t _size;
		size_t _capacity;
	};

	std::ostream& operator << (std::ostream& out, const string& str);
	std::istream& operator >> (std::istream& out, string& str);
	
	void test_string();
}